#include<cstdio>//uncle-lu
#include<cstring>
#include<algorithm>

const int INF = 1e9;
int n,d,k;
int dis[500010],c[500010];
int F[500010];

bool check(int x)
{
	memset(F,-INF,sizeof(F));
	int mind,maxd;
	if(x>=d)
	{
		mind = 1;
		maxd = x+d;
	}
	else
	{
		mind = d-x;
		maxd = x+d;
	}

	F[0] = 0;
	for(int i=1;i<=n;++i)
		for(int j=i-1;dis[i] - dis[j]<=maxd && j>=0;j--)
		{
			if(dis[i]-dis[j]<mind)continue;
			F[i] = std::max(F[i], F[j] + c[i]);
			if(F[i] >= k)return true;
		}

	return false;
}

int main()
{
	scanf("%d%d%d",&n,&d,&k);

	for(int i=1;i<=n;++i)
		scanf("%d%d",&dis[i],&c[i]);

	int l=0, r = INF , mid;
	while(l<r)
	{
		mid=(l+r)>>1;
		if(check(mid))
			r = mid-1;
		else
			l = mid+1;
	}

	if(r==INF)
		printf("-1");
	else
		printf("%d",mid);

	return 0;
}
